<?php

namespace App\Api;
use App\Domain\User\User as UserDomain;
use PhalApi\Api;


/**
 * 杭州华净接口
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */
class Huajing extends Api
{

    public function getRules()
    {
        return array(
           
            "select_where" => array(
                // 'table' => array('name' => 'table', 'require' => true, 'desc' => '表名'),
                // 'page'  => array('name' => 'page', 'require' => true, 'desc' => '当前页'),
                // 'size'  => array('name' => 'size', 'require' => true, 'desc' => '每页显示多少'),
                // 'order' => array('name' => 'order', 'require' => false, 'desc' => '排序'),
                // 'where' => array('name' => 'where', 'require' => true, 'desc' => '查询条件'),
            ),
   
        );
    }

   

    /**
     * 通用多条件查询接口
     * @desc 多条件查询接口
     * @return array data 被查数据
     * @exception 400 非法请求，参数传递错误
     */
    public function select_where()
    {
        // 最简单的处理方式
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
        header('Access-Control-Allow-Headers:*');

        $table = "idcard_check_list";
        // 按分页取数据
        $data = \PhalApi\DI()->notorm->$table
            ->where(
                array(
                    'rpic' => null,
                    "unit" => "杭州华净生物有限公司",
                    "create_time > ?" => '2023-09-18',
                    "create_time < ?" => '2023-10-31',
                    "state" => 'ok'
                )
            )
            ->fetchOne();
        return $data;

    }   
}
